<?php
	class Message_model extends CI_Model{
		//发送信息
		function add_message($fromuid,$touid,$subject,$content){
			$time=time();
			$username=$this->get_user_name($fromuid);
			$data = array(
				'fromuid' => $fromuid ,
				'touid' => $touid ,
				'subject' => $subject,
				'content' => $content,
				'from' => $username,
				'time' => $time
			 );
			 $this->db->insert('ask_message', $data);
		}
		function get_newmsg_num($uid){
			$this->db->where('touid',$uid);
			$this->db->where('new',1);
			$this->db->from('ask_message');
			$result=$this->db->count_all_results();
			return $result ?$result :0;
		}
	}